import { Component, OnInit } from '@angular/core';
import { HeaderComponent } from "../../modules/header/header.component";
import { RouterModule } from '@angular/router';

@Component({
  selector: 'app-home',
  standalone: true,
  templateUrl: './home.component.html',
  styleUrl: './home.component.scss',
  imports: [HeaderComponent, RouterModule]
})
export class HomeComponent implements OnInit {

  public accesstoken: any;

  constructor() { }

  async ngOnInit() {
    const observer = new IntersectionObserver((entries: IntersectionObserverEntry[]) => {
      entries.forEach((entry) => {
        console.log(entry);
        if (entry.isIntersecting) {
          entry.target.classList.add('show');
        } else {
          entry.target.classList.remove('show');
        }
      });
    });
    const hiddenElements = document.querySelectorAll<HTMLElement>('.hidden');
    hiddenElements.forEach((el) => observer.observe(el));
  }
  async getItemAccesstoken() {
    this.accesstoken = await localStorage.getItem('token');
  }
}
